using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using UMEVOR.BLL;
using UMEVOR.DTO;
using UMEVOR.VO;

public partial class Cadastro_LoginUMEVOR : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Session["Usuario"] = "";
        txtUsuario.Focus();
    }
    protected void btLimpar_Click(object sender, ImageClickEventArgs e)
    {
        txtSenha.Text = "";
        txtUsuario.Text = "";
    }
    protected void btLogin_Click(object sender, ImageClickEventArgs e)
    {
        this.txtUsuario.Text = Request.Form[txtUsuario.UniqueID];
        this.txtSenha.Text = Request.Form[txtSenha.UniqueID];
        string script;

        BLLT_USUARIO bllUsuario = new BLLT_USUARIO();

        if (bllUsuario.validarLogin(txtUsuario.Text, txtSenha.Text))
        {
            Session["Usuario"] = txtUsuario.Text;
            Response.Redirect("default.aspx");
        }
        else
        {
            script = "<script>alert('Dados incorretos!');</script>";
            ClientScript.RegisterStartupScript(Type.GetType("System.String"), "alert", script);
        }
    }
}
